module.exports = {
  publicPath: './',
  publicPath: './',
  // 去除 SourceMap
  productionSourceMap: false,
  configureWebpack: config => {
    // gzip 压缩
    const CompressionPlugin = require('compression-webpack-plugin');
    config.plugins.push(new CompressionPlugin());
    // 去除console.log
    const TerserPlugin = require('terser-webpack-plugin');
    config.optimization.minimizer.push(
     new TerserPlugin({
       extractComments: false,
       terserOptions: { compress: { drop_console: true } },
     }),
    );
    
  },
  chainWebpack: config => {
    // 图片压缩
    config.module
      .rule('images')
      .test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
      .use('image-webpack-loader')
      .loader('image-webpack-loader')
      .options({
        bypassOnDebug: true,
      })
      .end();
  }
}